import React from "react";
import { NavBar, Avatar } from "antd-mobile";
import { useNavigate } from "react-router-dom";
import style from "./index.module.css";
import { Cell } from "react-vant";
import {Modal } from "antd-mobile";
function Index() {
  const navigate = useNavigate();
  const back = () => navigate(-1);

  const goOut=()=>{
    localStorage.removeItem('token')
    navigate('/login')
  }
  return (
    <div className={style.setBox}>
      <NavBar style={{ backgroundColor: "#fff" }} onBack={back}>
        系统设置
      </NavBar>

      <div className={style.spanTop}>
        <span>头像</span>
        <span>
          <Avatar className={style.avatar} src="" />
        </span>
      </div>

      <Cell title="昵称" border={false} value={"用户名"} isLink />

      <Cell title="账号设置" border={false} isLink />

      <Cell title="隐私" border={false} isLink />

      <div className={style.spanTop3}>
        <span>当前版本</span>
        <span>4.0.0</span>
      </div>

      <div className={style.outLogin}>
        <span  onClick={async () => {
              const result = await Modal.confirm({
                title: '提醒',
                content: '确定退出登录吗',
              })
              if (result) {
                // Toast.show({ content: '点击了确认', position: 'bottom' })
                goOut()
              } else {
                // Toast.show({ content: '点击了取消', position: 'bottom' })

              }
            }}>
          退出登录
        </span>
      </div>
    </div>
  );
}

export default Index;
